<template>
	<!-- 待办案件列表 -->
	<view>
		<view class="myhome_Task" v-if="datallist.length>=2">
			<view class="flex minListw flex-between align-center" @click="allcase()">
				<image src="../../static/images/daiban_03.png" mode="" class="img"></image>
				<view class="min_left flex-g flex flex-between">
					<view class="">全部案件</view>
					<view class="caial" v-if="codeall>0">{{fliterNum(codeall)}}</view>
				</view>
			</view>
		</view>	
		<view class="lines"></view>
		<view class="myhome_Task">
			<view class="flex minListw flex-between align-center"
			v-for="(item,index) in datallist"
			:key="index"
			 @click="hsPerson(item)">
				<image src="../../static/images/daiban_06.png" mode="" class="img" v-if="item.name == '待核实'"></image>
				<image src="../../static/images/daiban_09.png" mode="" class="img" v-if="item.name == '待核查'"></image>
				<image src="../../static/images/daiban_14.png" mode="" class="img" v-if="item.name == '待派遣'"></image>
				<image src="../../static/images/daiban_17.png" mode="" class="img" v-if="item.name == '待回转'"></image>
				<image src="../../static/images/daiban_17.png" mode="" class="img" v-if="item.name == '待处置'"></image>
				<image src="../../static/images/daiban_19.png" mode="" class="img" v-if="item.name == '待审核'"></image>
				<view class="min_left flex-g flex flex-between">
					<view class="">{{item.name}}</view>
					<view class="caial" v-if="item.counts>0">{{fliterNum(item.counts)}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import filter from '../../common/getTimeqj.js'
	import {geteventCount} from '../../util/api.js'
	export default {
		data() {
			return {
				userInfor:uni.getStorageSync('userInfor'),
				codeall:0,
				allCode:[],
				datallist:[]
			}
		},
		onBackPress(e) {
			if(e.from === 'backbutton') {
				uni.reLaunch({
					url:'/pages/index/index'
				})
				return true;
			} else {
				uni.navigateBack();
			}
		},
		onLoad() {
			// console.log(uni.getSystemInfoSync())
			this.getCont()
		},
		methods: {
			getCont(){
				uni.showLoading()
				geteventCount({},this.userInfor.userId).then((res)=>{
					uni.hideLoading()
					if(res.code == 200){
						var codes = [];
						this.datallist = res.data;
						this.datallist.forEach(item=>{
							this.codeall += item.counts
							this.allCode =this.allCode.concat(item.dealStatus)
						})
					}else{
						this.datallist = [];
						this.$toast.showToast(res.msg)
					}
				}).catch((err)=>{
					console.log(err)
				})
			},
			fliterNum(e){
				if(e>99){
					return "99+";
				}else{
					return e;
				}
			},
			allcase(){
				var name = '全部案件';
				uni.navigateTo({
					url: '../allcase/allcase?allCode=' + JSON.stringify(this.allCode) + '&type=' + name,
				})
			},
			hsPerson(item){
				uni.navigateTo({
					url: '../allcase/allcase?allCode=' + JSON.stringify(item.dealStatus) + '&type=' + item.name,
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.mt30{
		margin-top: 30rpx;
	}
	.lines{
		width: 100%;
		height: 30rpx;
		background-color: #F2F4FB;
	}
.myhome_Task{
		background-color: #FFFFFF;
		padding: 0rpx 0rpx 0rpx 67rpx;
		.minListw{
			.min_left{
				padding: 30rpx 80rpx 25rpx 0rpx;
				border-bottom: 1px solid #F5F6F8;
				image{
					width: 20rpx;
					height: 36rpx;
				}
			}
			.caial{
				width: 50rpx;
				height: 50rpx;
				background-color: red;
				border-radius: 50%;
				display: flex;
				justify-content: center;
				align-items: center;
				color: #FFFFFF;
				font-size: 13px;
			}
			.img{
				width: 43rpx;
				height: 43rpx;
				margin-right: 40rpx;
			}
		}
	}
</style>
